cmake_minimum_required(VERSION 3.1.3)
project(rviz_plugin_scene_editor)

if (NOT "${CMAKE_CXX_STANDARD}")
    set(CMAKE_CXX_STANDARD 14)
endif ()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    # suppress warning in Ogre
    add_compile_options(-Wno-deprecated-register)
endif ()

# definition needed for boost/math/constants/constants.hpp included by Ogre to compile
add_definitions(-DBOOST_MATH_DISABLE_FLOAT128)

if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif ()

find_package(Boost REQUIRED thread date_time system filesystem)
find_package(catkin REQUIRED COMPONENTS
        class_loader
        geometric_shapes
        interactive_markers
        moveit_ros_perception
        moveit_ros_planning_interface
        moveit_ros_robot_interaction
        moveit_ros_warehouse
        object_recognition_msgs
        pluginlib
        rosconsole
        roscpp
        rospy
        rviz
        tf2_eigen
        roscpp
        rosconsole
        object_recognition_msgs
        )
# TODO: Remove when Kinetic support is dropped
if (rviz_VERSION VERSION_LESS 1.13.1) # Does rviz supports TF2?
    add_definitions(-DRVIZ_TF1)
endif ()

find_package(Eigen3 REQUIRED)

# Qt Stuff
if (rviz_QT_VERSION VERSION_LESS "5")
    find_package(Qt4 ${rviz_QT_VERSION} REQUIRED QtCore QtGui)
    include(${QT_USE_FILE})
    macro(qt_wrap_ui)
        qt4_wrap_ui(${ARGN})
    endmacro()
else ()
    find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets)
    set(QT_LIBRARIES Qt5::Widgets)
    macro(qt_wrap_ui)
        qt5_wrap_ui(${ARGN})
    endmacro()
endif ()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
add_definitions(-DQT_NO_KEYWORDS)

catkin_package()
# catkin_install_python(PROGRAMS scripts/moveit_joy.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
# catkin_python_setup()

include_directories(rviz_plugin_render_tools_mirror/include)
include_directories(rviz_plugin_scene_editor/include)

include_directories(SYSTEM
        ${catkin_INCLUDE_DIRS}
        ${Boost_INCLUDE_DIRS}
        ${EIGEN3_INCLUDE_DIRS}
        ${QT_INCLUDE_DIR})

add_subdirectory(rviz_plugin_render_tools_mirror)
add_subdirectory(rviz_plugin_scene_editor)

install(FILES
        rviz_plugin_scene_editor_description.xml
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

install(DIRECTORY icons DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

